package com.sky.mapper;

import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 批量新增套餐菜品关系
     * @param setmealDishes
     */
    void insertSetmealDishBatch(List<SetmealDish> setmealDishes);

    /**
     * 批量删除套餐所关联的菜品
     * @param ids
     */
    void delSetmealDishBatch(ArrayList<Integer> ids);


    /**
     * 根据菜品id查询套餐id
     * @param dishId
     * @return
     */
    @Select("select setmeal_id from setmeal_dish where dish_id=#{dishId}")
    List<Long> getSetmealsByDishId(Long dishId);


    /**
     * 统计关联了套餐的菜品数量
     * @param ids
     * @return
     */
    Integer countSetmealByDishId(List<Long> ids);
}
